#!/usr/bin/env python

import os, platform, logging

# Use os.path.join() instead of '+', this can make the script work both on Windows and other platform.

if platform.platform().startswith('Windows'):
	logFile = os.path.join(os.getenv('HOMEDRIVE'), os.getenv('HOMEPATH'), 'test.log')
else:
	logFile = os.path.join(os.getenv('HOME'), 'test.log')

print (logFile)

logging.basicConfig ( 
	level      = logging.DEBUG,
	format     = '%(asctime)s: %(levelname)s: %(message)s',
	filename   = logFile,
	filemode   = 'a'
)

logging.debug("Start of the program")
logging.info("Doing something")
logging.warning("Dying now")
